package com.yinhai.asynctask;

import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.yinhai.constant.Contact;

import android.content.Context;
import android.widget.Toast;

public class BackupCloudNoteTask  extends AsyncTaskForHttp{
	String retStr = null;
	public BackupCloudNoteTask(Context context) {
		super(context);
	}
	
	public BackupCloudNoteTask(Context context, boolean autoForword) {
		super(context, autoForword);
	}

	public BackupCloudNoteTask(Context context, int timeoutRequestCount,
			boolean autoForword) {
		super(context, timeoutRequestCount, autoForword);
	}
	@Override
	protected void parse(Map<String, Object> result) {
		this.retStr = (String)result.get(AsyncTaskContext.RESPONSE_CONTENT);
		JSONObject jsonObject;
		try {
			jsonObject = new JSONObject(retStr);
			
			boolean flag = jsonObject.getBoolean("success");
			if(flag){
				Toast.makeText(context, "备份成功", Toast.LENGTH_SHORT).show();
			}else{
				Toast.makeText(context, "备份失败,请重试", Toast.LENGTH_SHORT).show();
			}
			
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
